package com.vshop.utils.mail;

import org.springframework.mail.SimpleMailMessage;

/**
 * 邮件发送：
 * <p>
 * 自动装配邮件发送内容，主题，发件人，收件人
 *
 * @author lm
 * @date 2020/5/11 11:52
 */
public class SendMailUtil {
    /**
     * 抄送邮件地址
     */
    private String[] ccAddress = new String[]{"1556723929@qq.com", "guiwen.huang@linksfield.net", "guolei.wang@linksfield.net"};

    /**
     * Description 邮件发送自定义方法
     * <p>
     * 将异常消息发送到公司客服的邮箱：service@linksfield.net
     *
     * @param subject 邮件标题
     * @param text    邮件内容
     * @author WEIQI
     * @createDate 2019/6/14 17:03
     **/
    public SimpleMailMessage sendIdentifyingCode(String subject, String text) {
        SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
        simpleMailMessage.setSubject(subject);
        simpleMailMessage.setText(text);
        simpleMailMessage.setFrom("liumin@linksfield.net");
        simpleMailMessage.setTo("service@linksfield.net");
        simpleMailMessage.setCc(ccAddress);
        return simpleMailMessage;
    }

    /**
     * Description 邮件发送自定义方法
     * <p>
     * 将异常消息发送到个人的邮箱：1556723929@qq.com
     *
     * @param subject 邮件标题
     * @param text    邮件内容
     * @author WEIQI
     * @createDate 2020/5/11 11:51
     **/
    public SimpleMailMessage sendMailToPrivate(String subject, String text) {
        SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
        simpleMailMessage.setSubject(subject);
        simpleMailMessage.setText(text);
        simpleMailMessage.setFrom("liumin@linksfield.net");
        simpleMailMessage.setTo("1556723929@qq.com");
        simpleMailMessage.setCc(ccAddress);
        return simpleMailMessage;
    }
}
